
<form action="{:url('configEdit')}" method="post" class="form_single">


    <div class="box">
        <div class="box-body">
            <div class="row">

                {volist name="data" id= "vo"}
                {switch name="vo.type" }
                {case value="text" }

                <div class="layui-form-item">
                    <label for="{$vo.code}" class="layui-form-label">
                        <span class="x-red">*</span>{$vo.title}
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="{$vo.code}" name="{$vo.code}" required="" lay-verify="required"
                               autocomplete="off"  value="{$vo['value']|default=''}" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        ({$vo.title})
                    </div>
                </div>
                {/case}
                {case value="switch"}

                <div class="layui-form-item col-md-12">
                    <label class="layui-form-label">{$vo.title}</label>
                    <div class="layui-input-block">
                        {if condition="$vo['value'] eq 1"}
                        <div class="layui-unselect layui-form-switch layui-form-onswitch onkey" data-code="{$vo.code}"  ><em>ON</em><i></i></div>
                        <div class="layui-unselect layui-form-switch offkey" style="display: none" data-code="{$vo.code}" ><em>OFF</em><i></i></div>
                        {else/}
                        <div class="layui-unselect layui-form-switch layui-form-onswitch onkey" data-code="{$vo.code}" style="display: none" ><em>ON</em><i></i></div>
                        <div class="layui-unselect layui-form-switch offkey" data-code="{$vo.code}"  ><em>OFF</em><i></i></div>
                        {/if}
                    </div>
                    <input type="hidden" name="{$vo.code}"  value="{$vo['value']}"/>
                </div>

                {/case}
                {default /}

                <div class="layui-form-item">
                    <label for="{$vo.code}" class="layui-form-label">
                        <span class="x-red">*</span>{$vo.title}
                    </label>
                    <div class="layui-input-block">

                        {assign name="cover_id" value="$vo['value']|default='0'" /}
                        {:widget('file/index', ['name' => $vo.code, 'value' => $cover_id, 'type' => 'img'])}
                    </div>

                </div>


                {/switch}

                {/volist}





            </div>


            <div class="box-footer">



                {include file="layout/edit_btn_group"/}

            </div>

        </div>
    </div>
</form>


<script>


    $('.onkey').click(function () {
        $(this).hide();
        $(this).next().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(0);
    })
    $('.offkey').click(function () {
        $(this).hide();
        $(this).prev().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(1);

    })

</script>